package com.keepsport.keepsportapi.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.keepsport.keepsportapi.dto.CommunityCircleDto;
import com.keepsport.keepsportapi.entity.CommunityCircle;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/***
 *         O
 *      _ooOoo_
 *     o8888888o
 *     88" . "88
 *     (| -_- |)
 *      O\ = /O
 *  ____/`---'\____
 *  ...............
 *  佛祖保佑  永无BUG
 *   Data:2022/7/1
 *   Author:King
 *   Description:
 */
public interface CommunityCircleDao extends BaseMapper<CommunityCircle> {
    //查询说有的朋友圈信息
    @Select("select tcc.id,tu.name,tu.photo,tcc.content,tcc.likenum,tcc.ctime from t_community_circle tcc inner join t_user tu on tu.id=tcc.uid order by ctime desc ")
    List<CommunityCircleDto> queryAll();
    //分页查询所有的朋友圈信息
    List<CommunityCircleDto> selectLimit(@Param("start") int start,@Param("size") int size);
    //通过某一条朋友圈的id查找下面的所有评论
    @Select("select tcc.id,tu.name,tu.photo,tcc.content,tcc.likenum,tcc.ctime from t_community_circle tcc inner join t_user tu on tu.id=tcc.uid where tcc.id= #{id}")
    List<CommunityCircleDto> findOneById(@Param("id") int id);
}
